﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

namespace ARchGL.Platform.Migrations.TenantDb
{
    public partial class init : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "AbpAuditLogs",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: true),
                    ServiceName = table.Column<string>(nullable: true),
                    MethodName = table.Column<string>(nullable: true),
                    Parameters = table.Column<string>(nullable: true),
                    ExecutionTime = table.Column<DateTime>(nullable: false),
                    ExecutionDuration = table.Column<int>(nullable: false),
                    ClientIpAddress = table.Column<string>(nullable: true),
                    ClientName = table.Column<string>(nullable: true),
                    BrowserInfo = table.Column<string>(nullable: true),
                    Exception = table.Column<string>(nullable: true),
                    ImpersonatorUserId = table.Column<long>(nullable: true),
                    ImpersonatorTenantId = table.Column<int>(nullable: true),
                    CustomData = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpAuditLogs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpEntityChangeSets",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    BrowserInfo = table.Column<string>(maxLength: 512, nullable: true),
                    ClientIpAddress = table.Column<string>(maxLength: 64, nullable: true),
                    ClientName = table.Column<string>(maxLength: 128, nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ExtensionData = table.Column<string>(nullable: true),
                    ImpersonatorTenantId = table.Column<int>(nullable: true),
                    ImpersonatorUserId = table.Column<long>(nullable: true),
                    Reason = table.Column<string>(maxLength: 256, nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpEntityChangeSets", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpLanguages",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    Name = table.Column<string>(maxLength: 10, nullable: false),
                    DisplayName = table.Column<string>(maxLength: 64, nullable: false),
                    Icon = table.Column<string>(maxLength: 128, nullable: true),
                    IsDisabled = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpLanguages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpLanguageTexts",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    LanguageName = table.Column<string>(maxLength: 10, nullable: false),
                    Source = table.Column<string>(maxLength: 128, nullable: false),
                    Key = table.Column<string>(maxLength: 256, nullable: false),
                    Value = table.Column<string>(maxLength: 67108864, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpLanguageTexts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpNotificationSubscriptions",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    NotificationName = table.Column<string>(maxLength: 96, nullable: true),
                    EntityTypeName = table.Column<string>(maxLength: 250, nullable: true),
                    EntityTypeAssemblyQualifiedName = table.Column<string>(maxLength: 512, nullable: true),
                    EntityId = table.Column<string>(maxLength: 96, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpNotificationSubscriptions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpOrganizationUnits",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    ParentId = table.Column<long>(nullable: true),
                    Code = table.Column<string>(maxLength: 95, nullable: false),
                    DisplayName = table.Column<string>(maxLength: 128, nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    PrimaryId = table.Column<Guid>(nullable: true),
                    Sort = table.Column<int>(nullable: true),
                    Level = table.Column<int>(nullable: true),
                    Description = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpOrganizationUnits", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpOrganizationUnits_AbpOrganizationUnits_ParentId",
                        column: x => x.ParentId,
                        principalTable: "AbpOrganizationUnits",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "AbpTenantNotifications",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    NotificationName = table.Column<string>(maxLength: 96, nullable: false),
                    Data = table.Column<string>(maxLength: 1048576, nullable: true),
                    DataTypeName = table.Column<string>(maxLength: 512, nullable: true),
                    EntityTypeName = table.Column<string>(maxLength: 250, nullable: true),
                    EntityTypeAssemblyQualifiedName = table.Column<string>(maxLength: 512, nullable: true),
                    EntityId = table.Column<string>(maxLength: 96, nullable: true),
                    Severity = table.Column<byte>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpTenantNotifications", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserLoginAttempts",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    TenantId = table.Column<int>(nullable: true),
                    TenancyName = table.Column<string>(maxLength: 64, nullable: true),
                    UserId = table.Column<long>(nullable: true),
                    UserNameOrEmailAddress = table.Column<string>(maxLength: 255, nullable: true),
                    ClientIpAddress = table.Column<string>(maxLength: 64, nullable: true),
                    ClientName = table.Column<string>(maxLength: 128, nullable: true),
                    BrowserInfo = table.Column<string>(maxLength: 512, nullable: true),
                    Result = table.Column<byte>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    Type = table.Column<int>(nullable: true),
                    Version = table.Column<string>(maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserLoginAttempts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserNotifications",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    TenantNotificationId = table.Column<Guid>(nullable: false),
                    State = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserNotifications", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserOrganizationUnits",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    OrganizationUnitId = table.Column<long>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    UserPrimaryId = table.Column<Guid>(nullable: true),
                    OrganizationUnitPrimaryId = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserOrganizationUnits", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpUsers",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    AuthenticationSource = table.Column<string>(maxLength: 64, nullable: true),
                    UserName = table.Column<string>(maxLength: 256, nullable: false),
                    TenantId = table.Column<int>(nullable: true),
                    EmailAddress = table.Column<string>(maxLength: 256, nullable: false),
                    Name = table.Column<string>(maxLength: 64, nullable: false),
                    Surname = table.Column<string>(maxLength: 64, nullable: false),
                    Password = table.Column<string>(maxLength: 128, nullable: false),
                    EmailConfirmationCode = table.Column<string>(maxLength: 328, nullable: true),
                    PasswordResetCode = table.Column<string>(maxLength: 328, nullable: true),
                    LockoutEndDateUtc = table.Column<DateTime>(nullable: true),
                    AccessFailedCount = table.Column<int>(nullable: false),
                    IsLockoutEnabled = table.Column<bool>(nullable: false),
                    PhoneNumber = table.Column<string>(maxLength: 32, nullable: true),
                    IsPhoneNumberConfirmed = table.Column<bool>(nullable: false),
                    SecurityStamp = table.Column<string>(maxLength: 128, nullable: true),
                    IsTwoFactorEnabled = table.Column<bool>(nullable: false),
                    IsEmailConfirmed = table.Column<bool>(nullable: false),
                    IsActive = table.Column<bool>(nullable: false),
                    LastLoginTime = table.Column<DateTime>(nullable: true),
                    NormalizedUserName = table.Column<string>(maxLength: 256, nullable: false),
                    NormalizedEmailAddress = table.Column<string>(maxLength: 256, nullable: false),
                    ConcurrencyStamp = table.Column<string>(maxLength: 128, nullable: true),
                    ProfilePictureId = table.Column<Guid>(nullable: true),
                    ShouldChangePasswordOnNextLogin = table.Column<bool>(nullable: false),
                    SignInTokenExpireTimeUtc = table.Column<DateTime>(nullable: true),
                    SignInToken = table.Column<string>(nullable: true),
                    GoogleAuthenticatorKey = table.Column<string>(nullable: true),
                    PrimaryId = table.Column<Guid>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    Gender = table.Column<int>(nullable: false),
                    Avatar = table.Column<string>(nullable: true),
                    Position = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUsers", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpUsers_AbpUsers_CreatorUserId",
                        column: x => x.CreatorUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_AbpUsers_AbpUsers_DeleterUserId",
                        column: x => x.DeleterUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_AbpUsers_AbpUsers_LastModifierUserId",
                        column: x => x.LastModifierUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "JN_AppVersions",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    Version = table.Column<string>(maxLength: 50, nullable: true),
                    Content = table.Column<string>(maxLength: 4000, nullable: true),
                    UpdateTime = table.Column<DateTime>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Count = table.Column<int>(nullable: false),
                    NextContent = table.Column<string>(maxLength: 4000, nullable: true),
                    NextUpdateTime = table.Column<DateTime>(nullable: true),
                    Type = table.Column<int>(nullable: false),
                    Url = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_AppVersions", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_Attachments",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    PrimaryId = table.Column<Guid>(nullable: false),
                    FileId = table.Column<Guid>(nullable: false),
                    Name = table.Column<string>(maxLength: 256, nullable: true),
                    Url = table.Column<string>(maxLength: 256, nullable: true),
                    Size = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_Attachments", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_DocumentLibrarys",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    PrimaryId = table.Column<Guid>(nullable: true),
                    PrimaryId1 = table.Column<Guid>(nullable: false),
                    ParentId = table.Column<Guid>(nullable: true),
                    Name = table.Column<string>(maxLength: 100, nullable: true),
                    Size = table.Column<int>(nullable: false),
                    FileId = table.Column<Guid>(nullable: true),
                    Url = table.Column<string>(maxLength: 1000, nullable: true),
                    Extension = table.Column<string>(maxLength: 10, nullable: true),
                    Hash = table.Column<string>(maxLength: 50, nullable: true),
                    Path = table.Column<string>(maxLength: 200, nullable: true),
                    TaskId = table.Column<Guid>(maxLength: 50, nullable: false),
                    FileResponse = table.Column<string>(maxLength: 1000, nullable: true),
                    FileState = table.Column<int>(nullable: false),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    PType = table.Column<int>(nullable: false),
                    State = table.Column<bool>(nullable: false),
                    IsSystem = table.Column<bool>(nullable: false),
                    TransInfo = table.Column<string>(maxLength: 1000, nullable: true),
                    TemplateId = table.Column<Guid>(nullable: false),
                    MppRequest = table.Column<string>(nullable: true),
                    MppResponse = table.Column<string>(nullable: true),
                    MppCreateTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_DocumentLibrarys", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_DocumentShares",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    DocumentLibraryId = table.Column<Guid>(nullable: false),
                    Password = table.Column<string>(maxLength: 10, nullable: true),
                    Url = table.Column<string>(maxLength: 100, nullable: true),
                    ViewCount = table.Column<int>(nullable: false),
                    SaveCount = table.Column<int>(nullable: false),
                    DownloadCount = table.Column<int>(nullable: false),
                    ExpiresTime = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_DocumentShares", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_Notices",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    PrimaryId = table.Column<Guid>(nullable: true),
                    Title = table.Column<string>(maxLength: 500, nullable: true),
                    Content = table.Column<string>(nullable: true),
                    Type = table.Column<int>(nullable: false),
                    Status = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_Notices", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_NoticesUsers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<Guid>(nullable: false),
                    NoticeId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false, defaultValue: 1)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_NoticesUsers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectCategoryTemplate",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    Code = table.Column<string>(maxLength: 100, nullable: true),
                    Name = table.Column<string>(nullable: true),
                    ParentId = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    PType = table.Column<int>(nullable: false),
                    ParentCode = table.Column<string>(maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectCategoryTemplate", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectDrawings",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    SSOCreatorUserId = table.Column<Guid>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    CreatorUserName = table.Column<string>(maxLength: 64, nullable: true),
                    Name = table.Column<string>(maxLength: 100, nullable: true),
                    ImageUrl = table.Column<string>(nullable: true),
                    Path = table.Column<string>(nullable: true),
                    Size = table.Column<long>(nullable: false),
                    ModelGroupId = table.Column<Guid>(nullable: false),
                    TaskId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    FileName = table.Column<string>(maxLength: 100, nullable: true),
                    Hash = table.Column<string>(maxLength: 32, nullable: true),
                    Type = table.Column<string>(maxLength: 10, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectDrawings", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectModelGroups",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    CreatorUserName = table.Column<string>(maxLength: 64, nullable: true),
                    Name = table.Column<string>(maxLength: 100, nullable: true),
                    ImageUrl = table.Column<string>(maxLength: 255, nullable: true),
                    TaskId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectModelGroups", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectModels",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    SSOCreatorUserId = table.Column<Guid>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    CreatorUserName = table.Column<string>(maxLength: 64, nullable: true),
                    Name = table.Column<string>(maxLength: 100, nullable: true),
                    ImageUrl = table.Column<string>(maxLength: 255, nullable: true),
                    Path = table.Column<string>(maxLength: 1000, nullable: true),
                    Size = table.Column<long>(nullable: false),
                    ModelGroupId = table.Column<Guid>(nullable: false),
                    TaskId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    FileName = table.Column<string>(maxLength: 100, nullable: true),
                    Hash = table.Column<string>(maxLength: 32, nullable: true),
                    Type = table.Column<string>(maxLength: 10, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectModels", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectProperties",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    PropertyId = table.Column<string>(maxLength: 100, nullable: true),
                    ModelGroupId = table.Column<Guid>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    DocumentId = table.Column<Guid>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectProperties", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_Projects",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    Name = table.Column<string>(maxLength: 256, nullable: true),
                    Code = table.Column<string>(maxLength: 100, nullable: true),
                    Address = table.Column<string>(maxLength: 100, nullable: true),
                    Type = table.Column<int>(nullable: false),
                    IsSystem = table.Column<bool>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    ImageUrl = table.Column<string>(maxLength: 500, nullable: true),
                    Description = table.Column<string>(maxLength: 500, nullable: true),
                    Mark = table.Column<int>(nullable: false),
                    Location = table.Column<string>(nullable: true),
                    DepartName = table.Column<string>(nullable: true),
                    TotalInCome = table.Column<decimal>(nullable: true),
                    TakeLimit = table.Column<string>(nullable: true),
                    IsImportant = table.Column<int>(nullable: false),
                    IsApprove = table.Column<int>(nullable: false),
                    CompanyName = table.Column<string>(nullable: true),
                    CompanyLinkman = table.Column<string>(nullable: true),
                    CompanyLinkphone = table.Column<string>(nullable: true),
                    CompanyAddress = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_Projects", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectUsers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    UserId = table.Column<Guid>(nullable: false),
                    Position = table.Column<string>(maxLength: 100, nullable: true),
                    PermissionArray = table.Column<string>(maxLength: 1000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectUsers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ProjectViewPorts",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    ModelGroupId = table.Column<Guid>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    Path = table.Column<string>(maxLength: 2000, nullable: true),
                    ModelIdArray = table.Column<string>(maxLength: 255, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Url = table.Column<string>(maxLength: 255, nullable: true),
                    Point = table.Column<string>(maxLength: 2000, nullable: true),
                    Description = table.Column<string>(maxLength: 255, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ProjectViewPorts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_ReportWarehouses",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    DateTime = table.Column<string>(maxLength: 7, nullable: true),
                    Year = table.Column<int>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    Values = table.Column<string>(maxLength: 100, nullable: true),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_ReportWarehouses", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_SecurityCheckAndFeedbacks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CheckId = table.Column<Guid>(nullable: false),
                    NotifyUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    CCUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    Type = table.Column<int>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Content = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_SecurityCheckAndFeedbacks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_SecurityCheckItems",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Name = table.Column<string>(maxLength: 256, nullable: true),
                    ParentId = table.Column<Guid>(nullable: true),
                    Type = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_SecurityCheckItems", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_SecurityChecks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    CheckDate = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Number = table.Column<long>(nullable: false),
                    Content = table.Column<string>(maxLength: 500, nullable: true),
                    Result = table.Column<string>(maxLength: 500, nullable: true),
                    CheckItemId = table.Column<Guid>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    OriginStatus = table.Column<int>(nullable: false),
                    CheckUsersArray = table.Column<string>(nullable: true),
                    CCUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    SecurityChecksPropertysArray = table.Column<string>(maxLength: 1000, nullable: true),
                    ProjectViewPortsArray = table.Column<string>(maxLength: 1000, nullable: true),
                    NotifyUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    CorrectContent = table.Column<string>(maxLength: 1000, nullable: true),
                    CorrectDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_SecurityChecks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_SecurityChecksTurnOverHistorys",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CheckId = table.Column<Guid>(nullable: false),
                    UserArray = table.Column<string>(maxLength: 1000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_SecurityChecksTurnOverHistorys", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "JN_SelfChecks",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    CheckDate = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Number = table.Column<long>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Content = table.Column<string>(maxLength: 500, nullable: true),
                    CheckUsersArray = table.Column<string>(nullable: true),
                    NotifyUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    CCUsersArray = table.Column<string>(maxLength: 1000, nullable: true),
                    ProjectViewPortsArray = table.Column<string>(maxLength: 1000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_JN_SelfChecks", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_EventJobs",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    EventDate = table.Column<DateTime>(nullable: false),
                    EventArg = table.Column<int>(nullable: false),
                    IsFinish = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_EventJobs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectAttendances",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    WorkerId = table.Column<string>(maxLength: 50, nullable: true),
                    IdCardSHA = table.Column<string>(maxLength: 100, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Entry = table.Column<int>(nullable: false),
                    AttendanceTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectAttendances", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectCranes",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    SerialNumber = table.Column<string>(maxLength: 50, nullable: true),
                    ProjectId = table.Column<Guid>(nullable: false),
                    RecordTime = table.Column<DateTime>(nullable: true),
                    AngleTag = table.Column<string>(maxLength: 100, nullable: true),
                    RadiusTag = table.Column<string>(maxLength: 100, nullable: true),
                    LoadTag = table.Column<string>(maxLength: 100, nullable: true),
                    HeightTag = table.Column<string>(maxLength: 100, nullable: true),
                    WindSpeedTag = table.Column<string>(maxLength: 100, nullable: true),
                    ObliquityTag = table.Column<string>(maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectCranes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectDevices",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Type = table.Column<string>(maxLength: 20, nullable: true),
                    CertNo = table.Column<string>(maxLength: 50, nullable: true),
                    SN = table.Column<string>(maxLength: 50, nullable: true),
                    Alias = table.Column<string>(maxLength: 50, nullable: true),
                    SNRight = table.Column<string>(maxLength: 50, nullable: true),
                    AliasRight = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectDevices", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectEnvironments",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    SerialNumber = table.Column<string>(maxLength: 50, nullable: true),
                    RecordTime = table.Column<DateTime>(nullable: false),
                    TemperatureTag = table.Column<string>(maxLength: 100, nullable: true),
                    HumidityTag = table.Column<string>(maxLength: 100, nullable: true),
                    Pm2p5Tag = table.Column<string>(maxLength: 100, nullable: true),
                    Pm10Tag = table.Column<string>(maxLength: 100, nullable: true),
                    NoiseTag = table.Column<string>(maxLength: 100, nullable: true),
                    WindSpeedTag = table.Column<string>(maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectEnvironments", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectLifts",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    SerialNumber = table.Column<string>(maxLength: 100, nullable: true),
                    ProjectId = table.Column<Guid>(nullable: false),
                    RecordTime = table.Column<DateTime>(nullable: true),
                    LoadTag = table.Column<string>(maxLength: 100, nullable: true),
                    StartHeightTag = table.Column<string>(maxLength: 100, nullable: true),
                    StopHeightTag = table.Column<string>(maxLength: 100, nullable: true),
                    SpeedTag = table.Column<string>(maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectLifts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_Projects",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    Code = table.Column<string>(maxLength: 100, nullable: true),
                    Name = table.Column<string>(maxLength: 256, nullable: true),
                    Type = table.Column<string>(maxLength: 50, nullable: true),
                    ConstructionUnit = table.Column<string>(maxLength: 100, nullable: true),
                    BuilderUnit = table.Column<string>(maxLength: 100, nullable: true),
                    SupervisionUnit = table.Column<string>(maxLength: 100, nullable: true),
                    DesignUnit = table.Column<string>(maxLength: 100, nullable: true),
                    TestingUnit = table.Column<string>(maxLength: 100, nullable: true),
                    Address = table.Column<string>(maxLength: 500, nullable: true),
                    PlanStartDate = table.Column<DateTime>(nullable: true),
                    PlanEndDate = table.Column<DateTime>(nullable: true),
                    ActualStartDate = table.Column<DateTime>(nullable: true),
                    ActualEndDate = table.Column<DateTime>(nullable: true),
                    StructureArea = table.Column<double>(nullable: true),
                    Floor = table.Column<int>(nullable: true),
                    Description = table.Column<string>(maxLength: 500, nullable: true),
                    Height = table.Column<double>(nullable: true),
                    LocationX = table.Column<double>(nullable: true),
                    LocationY = table.Column<double>(nullable: true),
                    Images = table.Column<string>(nullable: true),
                    Area = table.Column<string>(maxLength: 100, nullable: true),
                    PakTerminalNo = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_Projects", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectUsers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    RealName = table.Column<string>(maxLength: 50, nullable: true),
                    RoleName = table.Column<string>(maxLength: 50, nullable: true),
                    WorkerType = table.Column<string>(maxLength: 50, nullable: true),
                    UserId = table.Column<Guid>(nullable: false),
                    Gender = table.Column<string>(maxLength: 20, nullable: true),
                    IdNoMarked = table.Column<string>(maxLength: 50, nullable: true),
                    IdCardSHA = table.Column<string>(maxLength: 50, nullable: true),
                    Type = table.Column<string>(maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectUsers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectVideoPlays",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    PlayUrl = table.Column<string>(maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectVideoPlays", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "QB_ProjectVideos",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: false),
                    Number = table.Column<int>(nullable: false),
                    IsOnline = table.Column<bool>(nullable: false),
                    CoverUrl = table.Column<string>(maxLength: 200, nullable: true),
                    PlayUrl = table.Column<string>(maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QB_ProjectVideos", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_HoistRealDatas",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    CurrentWeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    DoorLockStatus = table.Column<int>(nullable: false),
                    DriverIdentificationStatus = table.Column<int>(nullable: false),
                    HeightPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmReason = table.Column<int>(nullable: false),
                    Level = table.Column<int>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    LockStatus = table.Column<string>(maxLength: 10, nullable: true),
                    RealTimeGradient1 = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RealTimeGradient2 = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RealTimeHeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RealTimeLiftingWeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RealTimeNumberOfPeople = table.Column<int>(nullable: false),
                    RealTimeSpeed = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RealTimeSpeedDirection = table.Column<int>(nullable: false),
                    AlarmStatus = table.Column<int>(nullable: false),
                    SystemStatus = table.Column<string>(maxLength: 20, nullable: true),
                    TiltPercentage1 = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltPercentage2 = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WeightPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WindSpeed = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_HoistRealDatas", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_HoistReports",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    CurrentWeightAvg = table.Column<string>(maxLength: 60, nullable: true),
                    HeightPercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeGradient1Avg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeGradient2Avg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeHeightAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeLiftingWeightAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeNumberOfPeopleAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RealTimeSpeedAvg = table.Column<string>(maxLength: 60, nullable: true),
                    TiltPercentage1Avg = table.Column<string>(maxLength: 60, nullable: true),
                    TiltPercentage2Avg = table.Column<string>(maxLength: 60, nullable: true),
                    WeightPercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    WindSpeedAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RecordTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_HoistReports", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_Hoists",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    Forward = table.Column<int>(nullable: false),
                    HeightBottomAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    HeightBottomActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    HeightTopAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    HeightTopActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumCarryingNumber = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumElevatingCapacityAlarm = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumElevatingCapacityWarning = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumRiseHeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumApeedAlarm = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumSpeedWarning = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltAlarm = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltWarning = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    LoadWeightAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    LoadWeightActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    NoLoadWeightAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    NoLoadWeightActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_Hoists", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_Machines",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ProjectId = table.Column<Guid>(nullable: true),
                    BlackBoxId = table.Column<string>(maxLength: 36, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Status = table.Column<int>(nullable: false),
                    Type = table.Column<int>(nullable: false),
                    ImageUrl = table.Column<string>(maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_Machines", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_Majors",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Code = table.Column<string>(maxLength: 10, nullable: true),
                    ManageId = table.Column<string>(maxLength: 20, nullable: true),
                    Status = table.Column<int>(nullable: false),
                    Descr = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_Majors", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_ProjectUserAttendanceBinaryObjects",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<string>(maxLength: 20, nullable: true),
                    Code = table.Column<string>(maxLength: 20, nullable: true),
                    Type = table.Column<int>(nullable: false),
                    Bytes = table.Column<byte[]>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_ProjectUserAttendanceBinaryObjects", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_ProjectUserAttendances",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<string>(maxLength: 20, nullable: true),
                    SerialNumber = table.Column<string>(maxLength: 20, nullable: true),
                    RecordTime = table.Column<DateTime>(nullable: false),
                    Code = table.Column<string>(maxLength: 20, nullable: true),
                    Type = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_ProjectUserAttendances", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_ProjectUsers",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<string>(maxLength: 20, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Avatar = table.Column<byte[]>(nullable: true),
                    IdCard = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<string>(maxLength: 20, nullable: true),
                    Code = table.Column<string>(maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_ProjectUsers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_ProjectUsersExtends",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<string>(maxLength: 20, nullable: true),
                    IsManage = table.Column<int>(nullable: false),
                    TeamId = table.Column<Guid>(nullable: true),
                    MajorId = table.Column<Guid>(nullable: true),
                    Descr = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_ProjectUsersExtends", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_ProjectUsersRegister",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    UserId = table.Column<string>(maxLength: 20, nullable: true),
                    IdCard = table.Column<string>(maxLength: 20, nullable: true),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Gender = table.Column<int>(nullable: false),
                    Nation = table.Column<string>(maxLength: 20, nullable: true),
                    Birthday = table.Column<DateTime>(nullable: false),
                    Address = table.Column<string>(nullable: true),
                    LicenceIssuingAuthority = table.Column<string>(maxLength: 50, nullable: true),
                    ExpiryDate = table.Column<DateTime>(nullable: false),
                    IdPhoto = table.Column<string>(nullable: true),
                    Photo = table.Column<string>(nullable: true),
                    InfraRedPhoto = table.Column<string>(nullable: true),
                    Type = table.Column<int>(nullable: false),
                    SerialNumber = table.Column<string>(maxLength: 20, nullable: true),
                    CollectType = table.Column<int>(nullable: false),
                    Code = table.Column<string>(maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_ProjectUsersRegister", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_Teams",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    ManageId = table.Column<string>(maxLength: 20, nullable: true),
                    Status = table.Column<int>(nullable: false),
                    Descr = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_Teams", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_TowerCranes",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    circle_obstacle_1_center_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_1_center_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_1_center_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_1_radius_r = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_2_center_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_2_center_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_2_center_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_2_radius_r = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_3_center_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_3_center_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_3_center_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_3_radius_r = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_4_center_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_4_center_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_4_center_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    circle_obstacle_4_radius_r = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_starts_at_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_starts_at_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_starts_at_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_terminal_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_terminal_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_1_terminal_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_starts_at_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_starts_at_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_starts_at_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_terminal_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_terminal_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_2_terminal_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_starts_at_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_starts_at_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_starts_at_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_terminal_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_terminal_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_3_terminal_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_starts_at_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_starts_at_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_starts_at_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_terminal_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_terminal_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    linear_obstacle_4_terminal_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_AD_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_A_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_A_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_A_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_B_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_B_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_B_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_C_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_C_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_C_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_D_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_1_D_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_AD_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_A_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_A_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_A_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_B_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_B_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_B_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_C_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_C_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_C_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_D_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_2_D_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_AD_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_A_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_A_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_A_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_B_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_B_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_B_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_C_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_C_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_C_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_D_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_3_D_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_AD_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_A_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_A_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_A_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_B_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_B_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_B_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_C_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_C_point_y = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_C_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_D_point_x = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    quadrilateral_obstacle_4_D_point_z = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    ArticulatedLength = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    BalanceArmLength = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    BoomHeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    BoomLength = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    CoordinateX = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    CoordinateY = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    ManufacturerAndDeviceType = table.Column<int>(nullable: false),
                    Type = table.Column<string>(maxLength: 20, nullable: true),
                    Forward = table.Column<int>(nullable: false),
                    HeightLimitStartingValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    HeightLimitTerminalValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    HookWeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    LoadWeightAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    LoadWeightActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    NoLoadWeightAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    NoLoadWeightActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    Manufacturer = table.Column<string>(maxLength: 50, nullable: true),
                    MaximumLiftingWeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    MaximumTorque = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    PropertyStatus = table.Column<int>(nullable: false),
                    ProximalAmplitudeDemarcateAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    ProximalAmplitudeDemarcateActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    ProximalHeightDemarcateAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    ProximalHeightDemarcateActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RangeLimitStartingValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RangeLimitTerminalValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RemoteHeightDemarcate_AD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RemoteHeightDemarcateActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RemoteServiceDemarcateAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RemoteServiceDemarcateActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    Reserved = table.Column<string>(maxLength: 50, nullable: true),
                    Reserved2 = table.Column<string>(maxLength: 50, nullable: true),
                    RotationStartingPointAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RotationStartingPointActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RotationEndinigPointAD = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RotationEndinigPointActual = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RotationLimitStartingValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    RotationLimitTerminalValue = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    SensorInstallationStatus = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltTheCalibration = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TowerHatHeight = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningHorizontalDistance = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningPerpendicularDistance = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningTilt = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningTorque = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningWeightPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WarningWindPpeed = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmHorizontalDistance = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmPerpendicularDistance = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmTilt = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmTorque = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmWeightDistance = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    AlarmWindSpeed = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WindSpeedCalibration = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_TowerCranes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_TowerCranesRealDatas",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    AlarmReason = table.Column<int>(nullable: true),
                    BrakingStatus = table.Column<int>(nullable: false),
                    ElevatingCapacity = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    Height = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    ManufacturerAndDeviceType = table.Column<int>(nullable: false),
                    ProtocolVersion = table.Column<int>(nullable: false),
                    Range = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    Rotation = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltAngle = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TiltPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    TorquePercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WeightPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WindSpeed = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    WindSpeedPercentage = table.Column<decimal>(type: "DECIMAL(18, 6)", nullable: false),
                    Type = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_TowerCranesRealDatas", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TP_TowerCranesReports",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    TenantId = table.Column<int>(nullable: false),
                    CreatorUserId = table.Column<Guid>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    BlackBoxId = table.Column<string>(maxLength: 20, nullable: true),
                    Number = table.Column<int>(nullable: false),
                    ElevatingCapacityAvg = table.Column<string>(maxLength: 60, nullable: true),
                    HeightAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RangeAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RotationAvg = table.Column<string>(maxLength: 60, nullable: true),
                    TiltAngleAvg = table.Column<string>(maxLength: 60, nullable: true),
                    TiltPercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    TorquePercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    WeightPercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    WindSpeedAvg = table.Column<string>(maxLength: 60, nullable: true),
                    WindSpeedPercentageAvg = table.Column<string>(maxLength: 60, nullable: true),
                    RecordTime = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TP_TowerCranesReports", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AbpEntityChanges",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    ChangeTime = table.Column<DateTime>(nullable: false),
                    ChangeType = table.Column<byte>(nullable: false),
                    EntityChangeSetId = table.Column<long>(nullable: false),
                    EntityId = table.Column<string>(maxLength: 48, nullable: true),
                    EntityTypeFullName = table.Column<string>(maxLength: 192, nullable: true),
                    TenantId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpEntityChanges", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpEntityChanges_AbpEntityChangeSets_EntityChangeSetId",
                        column: x => x.EntityChangeSetId,
                        principalTable: "AbpEntityChangeSets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpRoles",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    Name = table.Column<string>(maxLength: 32, nullable: false),
                    DisplayName = table.Column<string>(maxLength: 64, nullable: false),
                    IsStatic = table.Column<bool>(nullable: false),
                    IsDefault = table.Column<bool>(nullable: false),
                    NormalizedName = table.Column<string>(maxLength: 32, nullable: false),
                    ConcurrencyStamp = table.Column<string>(maxLength: 128, nullable: true),
                    Description = table.Column<string>(maxLength: 500, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpRoles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpRoles_AbpUsers_CreatorUserId",
                        column: x => x.CreatorUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_AbpRoles_AbpUsers_DeleterUserId",
                        column: x => x.DeleterUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_AbpRoles_AbpUsers_LastModifierUserId",
                        column: x => x.LastModifierUserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "AbpSettings",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: true),
                    Name = table.Column<string>(maxLength: 256, nullable: false),
                    Value = table.Column<string>(maxLength: 2000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpSettings", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpSettings_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserClaims",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    ClaimType = table.Column<string>(maxLength: 256, nullable: true),
                    ClaimValue = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpUserClaims_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserLogins",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    LoginProvider = table.Column<string>(maxLength: 128, nullable: false),
                    ProviderKey = table.Column<string>(maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserLogins", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpUserLogins_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserRoles",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    RoleId = table.Column<int>(nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    UserPrimaryId = table.Column<Guid>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserRoles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpUserRoles_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpUserTokens",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    TenantId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: false),
                    LoginProvider = table.Column<string>(maxLength: 128, nullable: true),
                    Name = table.Column<string>(maxLength: 128, nullable: true),
                    Value = table.Column<string>(maxLength: 512, nullable: true),
                    ExpireDate = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpUserTokens", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpUserTokens_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpEntityPropertyChanges",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    EntityChangeId = table.Column<long>(nullable: false),
                    NewValue = table.Column<string>(maxLength: 512, nullable: true),
                    OriginalValue = table.Column<string>(maxLength: 512, nullable: true),
                    PropertyName = table.Column<string>(maxLength: 96, nullable: true),
                    PropertyTypeFullName = table.Column<string>(maxLength: 192, nullable: true),
                    TenantId = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId",
                        column: x => x.EntityChangeId,
                        principalTable: "AbpEntityChanges",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpPermissions",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    Name = table.Column<string>(maxLength: 128, nullable: false),
                    IsGranted = table.Column<bool>(nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    RoleId = table.Column<int>(nullable: true),
                    UserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpPermissions", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpPermissions_AbpRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AbpRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_AbpPermissions_AbpUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AbpUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AbpRoleClaims",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    TenantId = table.Column<int>(nullable: true),
                    RoleId = table.Column<int>(nullable: false),
                    ClaimType = table.Column<string>(maxLength: 256, nullable: true),
                    ClaimValue = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AbpRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AbpRoleClaims_AbpRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AbpRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AbpAuditLogs_TenantId_ExecutionDuration",
                table: "AbpAuditLogs",
                columns: new[] { "TenantId", "ExecutionDuration" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpAuditLogs_TenantId_ExecutionTime",
                table: "AbpAuditLogs",
                columns: new[] { "TenantId", "ExecutionTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpAuditLogs_TenantId_UserId",
                table: "AbpAuditLogs",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChanges_EntityChangeSetId",
                table: "AbpEntityChanges",
                column: "EntityChangeSetId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChanges_EntityTypeFullName_EntityId",
                table: "AbpEntityChanges",
                columns: new[] { "EntityTypeFullName", "EntityId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_CreationTime",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_Reason",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "Reason" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityChangeSets_TenantId_UserId",
                table: "AbpEntityChangeSets",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpEntityPropertyChanges_EntityChangeId",
                table: "AbpEntityPropertyChanges",
                column: "EntityChangeId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpLanguages_TenantId_Name",
                table: "AbpLanguages",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpLanguageTexts_TenantId_Source_LanguageName_Key",
                table: "AbpLanguageTexts",
                columns: new[] { "TenantId", "Source", "LanguageName", "Key" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpNotificationSubscriptions_NotificationName_EntityTypeNam~",
                table: "AbpNotificationSubscriptions",
                columns: new[] { "NotificationName", "EntityTypeName", "EntityId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpNotificationSubscriptions_TenantId_NotificationName_Enti~",
                table: "AbpNotificationSubscriptions",
                columns: new[] { "TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpOrganizationUnits_ParentId",
                table: "AbpOrganizationUnits",
                column: "ParentId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpOrganizationUnits_TenantId_Code",
                table: "AbpOrganizationUnits",
                columns: new[] { "TenantId", "Code" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissions_TenantId_Name",
                table: "AbpPermissions",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissions_RoleId",
                table: "AbpPermissions",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpPermissions_UserId",
                table: "AbpPermissions",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoleClaims_RoleId",
                table: "AbpRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoleClaims_TenantId_ClaimType",
                table: "AbpRoleClaims",
                columns: new[] { "TenantId", "ClaimType" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoles_CreatorUserId",
                table: "AbpRoles",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoles_DeleterUserId",
                table: "AbpRoles",
                column: "DeleterUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoles_LastModifierUserId",
                table: "AbpRoles",
                column: "LastModifierUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpRoles_TenantId_NormalizedName",
                table: "AbpRoles",
                columns: new[] { "TenantId", "NormalizedName" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpSettings_UserId",
                table: "AbpSettings",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpSettings_TenantId_Name",
                table: "AbpSettings",
                columns: new[] { "TenantId", "Name" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpTenantNotifications_TenantId",
                table: "AbpTenantNotifications",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserClaims_UserId",
                table: "AbpUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserClaims_TenantId_ClaimType",
                table: "AbpUserClaims",
                columns: new[] { "TenantId", "ClaimType" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserLoginAttempts_UserId_TenantId",
                table: "AbpUserLoginAttempts",
                columns: new[] { "UserId", "TenantId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserLoginAttempts_TenancyName_UserNameOrEmailAddress_Res~",
                table: "AbpUserLoginAttempts",
                columns: new[] { "TenancyName", "UserNameOrEmailAddress", "Result" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserLogins_UserId",
                table: "AbpUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserLogins_TenantId_UserId",
                table: "AbpUserLogins",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserLogins_TenantId_LoginProvider_ProviderKey",
                table: "AbpUserLogins",
                columns: new[] { "TenantId", "LoginProvider", "ProviderKey" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserNotifications_UserId_State_CreationTime",
                table: "AbpUserNotifications",
                columns: new[] { "UserId", "State", "CreationTime" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserOrganizationUnits_TenantId_OrganizationUnitId",
                table: "AbpUserOrganizationUnits",
                columns: new[] { "TenantId", "OrganizationUnitId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserOrganizationUnits_TenantId_UserId",
                table: "AbpUserOrganizationUnits",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserRoles_UserId",
                table: "AbpUserRoles",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserRoles_TenantId_RoleId",
                table: "AbpUserRoles",
                columns: new[] { "TenantId", "RoleId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserRoles_TenantId_UserId",
                table: "AbpUserRoles",
                columns: new[] { "TenantId", "UserId" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUsers_CreatorUserId",
                table: "AbpUsers",
                column: "CreatorUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUsers_DeleterUserId",
                table: "AbpUsers",
                column: "DeleterUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUsers_LastModifierUserId",
                table: "AbpUsers",
                column: "LastModifierUserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUsers_TenantId_NormalizedEmailAddress",
                table: "AbpUsers",
                columns: new[] { "TenantId", "NormalizedEmailAddress" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUsers_TenantId_NormalizedUserName",
                table: "AbpUsers",
                columns: new[] { "TenantId", "NormalizedUserName" });

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserTokens_UserId",
                table: "AbpUserTokens",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AbpUserTokens_TenantId_UserId",
                table: "AbpUserTokens",
                columns: new[] { "TenantId", "UserId" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AbpAuditLogs");

            migrationBuilder.DropTable(
                name: "AbpEntityPropertyChanges");

            migrationBuilder.DropTable(
                name: "AbpLanguages");

            migrationBuilder.DropTable(
                name: "AbpLanguageTexts");

            migrationBuilder.DropTable(
                name: "AbpNotificationSubscriptions");

            migrationBuilder.DropTable(
                name: "AbpOrganizationUnits");

            migrationBuilder.DropTable(
                name: "AbpPermissions");

            migrationBuilder.DropTable(
                name: "AbpRoleClaims");

            migrationBuilder.DropTable(
                name: "AbpSettings");

            migrationBuilder.DropTable(
                name: "AbpTenantNotifications");

            migrationBuilder.DropTable(
                name: "AbpUserClaims");

            migrationBuilder.DropTable(
                name: "AbpUserLoginAttempts");

            migrationBuilder.DropTable(
                name: "AbpUserLogins");

            migrationBuilder.DropTable(
                name: "AbpUserNotifications");

            migrationBuilder.DropTable(
                name: "AbpUserOrganizationUnits");

            migrationBuilder.DropTable(
                name: "AbpUserRoles");

            migrationBuilder.DropTable(
                name: "AbpUserTokens");

            migrationBuilder.DropTable(
                name: "JN_AppVersions");

            migrationBuilder.DropTable(
                name: "JN_Attachments");

            migrationBuilder.DropTable(
                name: "JN_DocumentLibrarys");

            migrationBuilder.DropTable(
                name: "JN_DocumentShares");

            migrationBuilder.DropTable(
                name: "JN_Notices");

            migrationBuilder.DropTable(
                name: "JN_NoticesUsers");

            migrationBuilder.DropTable(
                name: "JN_ProjectCategoryTemplate");

            migrationBuilder.DropTable(
                name: "JN_ProjectDrawings");

            migrationBuilder.DropTable(
                name: "JN_ProjectModelGroups");

            migrationBuilder.DropTable(
                name: "JN_ProjectModels");

            migrationBuilder.DropTable(
                name: "JN_ProjectProperties");

            migrationBuilder.DropTable(
                name: "JN_Projects");

            migrationBuilder.DropTable(
                name: "JN_ProjectUsers");

            migrationBuilder.DropTable(
                name: "JN_ProjectViewPorts");

            migrationBuilder.DropTable(
                name: "JN_ReportWarehouses");

            migrationBuilder.DropTable(
                name: "JN_SecurityCheckAndFeedbacks");

            migrationBuilder.DropTable(
                name: "JN_SecurityCheckItems");

            migrationBuilder.DropTable(
                name: "JN_SecurityChecks");

            migrationBuilder.DropTable(
                name: "JN_SecurityChecksTurnOverHistorys");

            migrationBuilder.DropTable(
                name: "JN_SelfChecks");

            migrationBuilder.DropTable(
                name: "QB_EventJobs");

            migrationBuilder.DropTable(
                name: "QB_ProjectAttendances");

            migrationBuilder.DropTable(
                name: "QB_ProjectCranes");

            migrationBuilder.DropTable(
                name: "QB_ProjectDevices");

            migrationBuilder.DropTable(
                name: "QB_ProjectEnvironments");

            migrationBuilder.DropTable(
                name: "QB_ProjectLifts");

            migrationBuilder.DropTable(
                name: "QB_Projects");

            migrationBuilder.DropTable(
                name: "QB_ProjectUsers");

            migrationBuilder.DropTable(
                name: "QB_ProjectVideoPlays");

            migrationBuilder.DropTable(
                name: "QB_ProjectVideos");

            migrationBuilder.DropTable(
                name: "TP_HoistRealDatas");

            migrationBuilder.DropTable(
                name: "TP_HoistReports");

            migrationBuilder.DropTable(
                name: "TP_Hoists");

            migrationBuilder.DropTable(
                name: "TP_Machines");

            migrationBuilder.DropTable(
                name: "TP_Majors");

            migrationBuilder.DropTable(
                name: "TP_ProjectUserAttendanceBinaryObjects");

            migrationBuilder.DropTable(
                name: "TP_ProjectUserAttendances");

            migrationBuilder.DropTable(
                name: "TP_ProjectUsers");

            migrationBuilder.DropTable(
                name: "TP_ProjectUsersExtends");

            migrationBuilder.DropTable(
                name: "TP_ProjectUsersRegister");

            migrationBuilder.DropTable(
                name: "TP_Teams");

            migrationBuilder.DropTable(
                name: "TP_TowerCranes");

            migrationBuilder.DropTable(
                name: "TP_TowerCranesRealDatas");

            migrationBuilder.DropTable(
                name: "TP_TowerCranesReports");

            migrationBuilder.DropTable(
                name: "AbpEntityChanges");

            migrationBuilder.DropTable(
                name: "AbpRoles");

            migrationBuilder.DropTable(
                name: "AbpEntityChangeSets");

            migrationBuilder.DropTable(
                name: "AbpUsers");
        }
    }
}
